package com.wms.storage.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.common.web.dto.request.FuzzyPageDTO;
import com.common.web.dto.response.RestResponse;
import com.wms.storage.feign.ParamFeign;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@Api(value = "存储Controller", tags = "存储接口")
@RefreshScope
public class StorageController {

	@Autowired
	private ParamFeign paramFeign;
	
	@Value("${testConfig:}")
	private String testConfig;
	
    @ApiOperation(value = "列表", notes = "无参数")
    @GetMapping("/wms-storage/list")
    public RestResponse list(){
		RestResponse apiResult=RestResponse.success();
		apiResult.setData("来自存储库房，8090的返回;testConfig="+testConfig);
		return apiResult;
    }

    @ApiOperation(value = "列表", notes = "无参数")
    @GetMapping("wms-storage2/list")
    public RestResponse list2(){
		RestResponse apiResult=RestResponse.success();
		apiResult.setData("来自存储库房，8090的返回;testConfig="+testConfig);
		return apiResult;
    }
    
    @ApiOperation(value = "从admin微服务获取参数信息", notes = "从admin微服务获取参数信息")
    @GetMapping("wms-storage/listParam")
    public RestResponse listParam(){
    	System.out.println("从admin获取参数信息。使用了feign的微服务获取");
		RestResponse dto= paramFeign.listAllDevice(new FuzzyPageDTO());
		return dto;
    }
}
